<%--
    Document   : myprofile
    Created on : Apr 27, 2011, 3:22:32 PM
    Author     : Kevin
--%>

<%@page contentType="text/html" import="com.movie.*" import="java.util.*"  pageEncoding="UTF-8"%>
<%@include file="headerv.html"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>User profile</title>
    </head>
    <body>
        <h1>User Profile</h1>
        <%Viewer v = (Viewer) request.getSession().getAttribute("user");%><br>
        <table>
            <tr>
                <td>
                    username:
                </td>
                <td>
                    <%=v.getUsername()%>
                </td>
                <td>
                    
                </td>
            </tr>
            <tr>
                <td>
                    password:
                </td>
                <td>
                    <%=v.getNickname()%>
                </td>
                <td>
                    
                </td>
            </tr>
            <tr>
                <td>
                     first name:
                </td>
                <td>
                    <%=v.getFirstname()%>
                </td>
                <td>
                    
                </td>
            </tr>
            <tr>
                <td>
                    last name:
                </td>
                <td>
                    <%=v.getLastname()%>
                </td>
                <td>
                    
                </td>
            </tr>
            <tr>
                <td>
                    email:
                </td>
                <td>
                    <%=v.getEmail()%>
                </td>
                <% if(v.getEmailpublic().equals(true)) {%>
                <td>
                    &nbsp&nbsp&nbsp&nbsp It is opened to the public.&nbsp; <input type="button" value="Close it" onclick="javascript:location.href='dispatcher?operation=switchemailpublic'">
                </td>
                <%}%>
                <%if(v.getEmailpublic().equals(false)) {%>
                <td>
                    It is not opened to the public.&nbsp; <input type="button" value="Open it" onclick="javascript:location.href='dispatcher?operation=switchemailpublic'">
                </td>
                <%}%>
            </tr>
            <tr>
                <td>
                    birthday:
                </td>
                <td>
                    <%=v.getYearofbirth()%>
                </td>
                <% if(v.getYearofbirthpublic().equals(true)) {%>
                <td>
                    &nbsp&nbsp&nbsp&nbspIt is opened to the public.&nbsp; <input type="button" value="Close it" onclick="javascript:location.href='dispatcher?operation=switchbirthdaypublic'">
                </td>
                <%}%>
                <%if(v.getYearofbirthpublic().equals(false)) {%>
                <td>
                    It is not opened to the public.&nbsp; <input type="button" value="Open it" onclick="javascript:location.href='dispatcher?operation=switchbirthdaypublic'">
                </td>
                <%}%>
            </tr>
            <tr>
                <td>
                    Favourite genres:
                </td>
                <td>
                    <%Iterator it = v.getGenres().iterator();
            while (it.hasNext()) {
                Genre genre = (Genre) it.next();
                out.print(genre.getName());
            }%>
                </td>
                <td>
                    
                </td>
            </tr>
            <tr>
                <td>
                     Favourite actors/actress: 
                </td>
                <td>
                     <%Iterator it2 = v.getActors().iterator();
            while (it2.hasNext()) {%>
        <% Actor actor = (Actor) it2.next();%>
        <% out.print(actor.getFirstname());%> <%out.print(actor.getLastname());%>
        <%}%>
                </td>
                <td>
                    
                </td>
            </tr>
        </table>
  
        <input type="button" value="EditMyProfile" onclick="javascript:location.href='dispatcher?operation=editprofile'">
        <br><br>
        <h1>Your Social Network</h1>
        <br>
        <a href="dispatcher?operation=requestlist">Check the friend adding request</a><br>
        <a href="dispatcher?operation=friendlist">See my Friend List </a><br>
        <a href="searchFriend.jsp">Search friend </a><br>

    </body>

    <%@include file="footer.html"%>
</html>
